<?php
/**
*File Name:function.php
*Date:2016年4月16日下午3:04:21
*Copyright  (c)2016,783188184@qq.com All Rights Reserved
*____________________________________________________________________________________________________
*/
/*** 获得周排行榜数据
 +----------------------------------------------------------
 * @param string $pid 所属父类栏目
 * @return array 2维数组
 */
 function movieRankcontent($where){
 	
	 $m = M('movie');
	 $lasttime = time()-86400*7;
	 $where['v_lasthittime'] = array('gt',$lasttime);
	 $res = $m->where($where)->order('v_weekhits desc')->limit(16)->select();
	 return $res;
}

/*** 获得月排行榜数据
 +----------------------------------------------------------
 * @param string $pid 所属父类栏目
 * @return array 2维数组
 */
function movieRankmonth($where){
	$m = M('movie');
	$lasttime = time()-86400*30;
	$where['v_lasthittime'] = array('gt',$lasttime);
	$res = $m->where($where)->order('v_weekhits desc')->limit(16)->select();
	return $res;
}

/*** 分解出相应下载的url和名称
 +----------------------------------------------------------
 * @param string $urlstr 传递过来的带分解的下载字符串 剔除了下载类型的
 * @return array 2维数组  名称和
 */
function explode_url($urlstr){
	$arrwiturl = explode('$$$$',$urlstr);
    $url = array();
    foreach($arrwiturl as $v){
       $rowurl = explode('||||',$v);
       $assocurl['name'] = $rowurl['0'];
       $assocurl['url'] = $rowurl['1'];
       $url[] = $assocurl;
     }
     return $url;
}